/**
 * Copyright:Copyright(c)2014-2017
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.services.manage.nature.dao.impl;

import org.springframework.stereotype.Repository;
import shop.core.common.dao.BaseDao;
import shop.core.common.dao.page.PagerModel;
import shop.services.manage.nature.bean.Nature;
import shop.services.manage.nature.dao.NatureDao;

import javax.annotation.Resource;
import java.util.List;

/**
 * @类名称：NatureDaoImpl
 * @创建人：Ltz
 * @创建时间：2017-10-14 下午21:06:41  
 * @版本号：1.0
 * @描述：
 */
@Repository("natureDaoManage")
public class NatureDaoImpl  implements NatureDao {

    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }

    public PagerModel selectPageList(Nature e) {
        return dao.selectPageList("manage.nature.selectPageList","manage.nature.selectPageCount", e);
    }

    public List selectList(Nature e) {
        return dao.selectList("manage.nature.selectList", e);
    }

    public Nature selectOne(Nature e) {
        return (Nature) dao.selectOne("manage.nature.selectOne", e);
    }

    public int delete(Nature e) {
        return dao.delete("manage.nature.delete", e);
    }

    public int update(Nature e) {
        return dao.update("manage.nature.update", e);
    }

    public int deletes(String[] ids) {
        Nature e = new Nature();
        for (int i = 0; i < ids.length; i++) {
            e.setId(ids[i]);
            delete(e);
        }
        return 0;
    }

    public int insert(Nature e) {
        return dao.insert("manage.nature.insert", e);
    }

    public int deleteById(int id) {
        return dao.delete("manage.nature.deleteById", id);
    }

    @Override
    public Nature selectById(String id) {
        return (Nature) dao.selectOne("manage.nature.selectById", id);
    }

    /**
     * 删除商品要删除对应的商品参数
     * */
    public int deleteByPID(int id) {
        return dao.delete("manage.nature.deleteByPID", id);
    }

    /**
     * 根据参数名称删除
     * */
    public int deleteByName(String name) {
        return dao.delete("manage.nature.deleteByName", name);
    }
}

